<%--
 *  File:    PharmacySelectPop.jsp
 *  @Author: Kevinfan
 *  Date:    4/11/2011
 *
 *  Copyright (C) 2000 - 2012 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.PharmacySelectPop");  
  String strModuleName = "TDR";
  String contextPath = request.getContextPath();
  String strTableName = "v_pharmacysummary";
  Integer sourceorgid = new Integer(-1);
%>
<%@ include file="/inc/PageDefault.inc" %>
<html>
<head>
<title>Add</title>
<PageFlow:CheckPageFlow pageName="p_pharmacysummarypop"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/cn/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%  
  Vector orgs = (Vector)pageContext.getAttribute("totalsummary");
  if(orgs == null) orgs = new Vector();  
%>

<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(frm,actionvalue,orderbyname);
  editform.action = "PharmacySelectPop.jsp?maxitem=8&<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="frm" method="post">
<table width="100%" cellspacing="0" cellpadding="0" height="100%">
    <input type="hidden" name="pagename" value="p_pharmacysummarypop">
    <input type="hidden" name="actionname">
    <tr>
      <td valign="top">
        <table width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="summary_top"></td>
          </tr>
        </table>
        <table width="100%" cellspacing="0" cellpadding="0">
         <%@ include file="/inc/SummarySearch.inc" %>
        </table> 
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
	  <tr class="deepblue-left">
		  <td class="title_center" width="1%">&nbsp;</td>
		  <td class="title_center" width="25%">&nbsp;<a href="javascript:page_summary('orderby','pharmacycode')"><%= label.getLabelName("L_PharmacyCode") %></a></td>
		  <td class="title_center" width="49%">&nbsp;<a href="javascript:page_summary('orderby','pharmacyname')"><%= label.getLabelName("L_PharmacyName") %></a></td>
      </tr>

     <%
        int i = 0;
        String strIsChecked = new String("Checked");
        String strClassType = new String();   
        Integer nOrgId = null;
        String strOrgName = "";    
        String strOrgCode = ""; 
	    String strOrgStatus = "";	
     %>
     <logic:iterate id="org" collection="<%= orgs %>">                      
      
     <%
       HashMap orgMap = (HashMap)pageContext.getAttribute("org"); 
       if(i%2 == 1)
       {
         strClassType = "td-listrom";
       }else{                    
         strClassType = "";
       }
       if(i != 0)
       {          
         strIsChecked = "";
       }
       else
       {
         nOrgId = (Integer)(orgMap.get("pharmacyid"));
         strOrgName = (String)(orgMap.get("pharmacyname"));  
         strOrgCode = (String)(orgMap.get("pharmacycode"));  
		 strOrgStatus = (String)(orgMap.get("statusname"));
       }  
              
       i++;        
     %>   
     <tr onmouseover="this.className='tr-over'" 
         onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"
         class="<%=JspHelper.filterNull(strClassType)%>"  
         onClick="javascript:radiotrue('selectItem<%=JspHelper.filterNull( i )%>');
                             parent.page_setPharmacy('<%=JspHelper.filterNull( orgMap.get("pharmacyid") )%>', '<%= OvalTools.replaceQuot(orgMap.get("pharmacyname")) %>','<%= OvalTools.replaceQuot(orgMap.get("pharmacycode")) %>','<%=OvalTools.replaceQuot(orgMap.get("pharmacytypename"))%>','<%=OvalTools.replaceQuot(orgMap.get("pharmacylevelname"))%>')">    
      <td> 
        <input id="selectItem<%=JspHelper.filterNull( i )%>" type="radio" name="selectOrg" class="normalradio" value="<%=JspHelper.filterNull( orgMap.get("pharmacyid") )%>" <%=JspHelper.filterNull( strIsChecked )%> >
      </td>
      <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( orgMap.get("pharmacycode") )%></td>
      <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( orgMap.get("pharmacyname") )%></td>
      </tr>
    </logic:iterate> 
         <%@ include file="/inc/SummaryActionPop.inc" %>
      </table>
      </td>
    </tr>   
</table>
</form>
<%
	if (orgs.size() == 1) {
%>
<script>setParentValue();</script>
<%	} else if (orgs.size() == 0) { %>
<script>setError();</script>
<%	} %>
</body>
</html>